package com.yhj.reggie.mapper;

import com.yhj.reggie.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EmployeeMapper {

    //根据用户名查找用户
    @Select("select * from employee where username=#{username}")
    Employee login(Employee employee);

    //新增员工
    @Insert("insert into employee values (null,#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    Integer saveEmployee(Employee employee);

    //分页查询
    List<Employee> findEmployeeByPage (@Param("name") String name);

    //修改用户
    Integer update(Employee employee);

    //根据用户id查找用户
    @Select("select id,name,username,phone,sex,id_number from employee where id=#{id}")
    Employee findById(Long id);
}
